using System;
using System.Collections.Generic;
using System.Text;
using CMS.BIZ;
using AAM.DAL;
using AAM.BIZ;
using AAM.SQL;

namespace CMS.BOP
{
    public class SqlBizControlProvider : SqlBizObjectProvider<BizControl>
    {

        public BizControl Read(int id)
        {
            return Read(new ObjectID(BizControl.ObjectType, new object[] { id }));
        }
        public List<BizControl> ReadByPageID(int pageId)
        {
            Command command = Connection.CreateCommand("SELECT * FROM Controls WHERE PageID=?");
            command.AddParameter(pageId);
            DataReader reader = command.ExecuteReader();
            List<BizControl> list = CreateListFromReader(reader);
            reader.Close();
            command.Dispose();
            return list;
        }
        public bool Delete(int id)
        {
            return Delete(new ObjectID(BizControl.ObjectType, new object[] { id }));
        }
    }
}
